// File generated from our OpenAPI spec by Stainless.

package com.metest.api.services.blocking

import com.metest.api.core.ClientOptions
import com.metest.api.services.blocking.rest.ActuatorService
import com.metest.api.services.blocking.rest.ActuatorServiceImpl
import java.util.function.Consumer

class RestServiceImpl internal constructor(private val clientOptions: ClientOptions) : RestService {

    private val withRawResponse: RestService.WithRawResponse by lazy {
        WithRawResponseImpl(clientOptions)
    }

    private val actuator: ActuatorService by lazy { ActuatorServiceImpl(clientOptions) }

    override fun withRawResponse(): RestService.WithRawResponse = withRawResponse

    override fun withOptions(modifier: Consumer<ClientOptions.Builder>): RestService =
        RestServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build())

    override fun actuator(): ActuatorService = actuator

    class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
        RestService.WithRawResponse {

        private val actuator: ActuatorService.WithRawResponse by lazy {
            ActuatorServiceImpl.WithRawResponseImpl(clientOptions)
        }

        override fun withOptions(
            modifier: Consumer<ClientOptions.Builder>
        ): RestService.WithRawResponse =
            RestServiceImpl.WithRawResponseImpl(
                clientOptions.toBuilder().apply(modifier::accept).build()
            )

        override fun actuator(): ActuatorService.WithRawResponse = actuator
    }
}
